from pydantic import BaseModel, ValidationError, validator
from datetime import datetime

class CompanyBase(BaseModel):
    userId: str
    name: str
    gender: str
    alias: str
    placeOfOrigin: str
    profession: str
    age: int
    style: str
    other: str
    goal: str
    template: str
    notes: str

# 请求模型
class CompanyQueryRequest(BaseModel):
    l2_id: str
    keyword: str
    page: int
    page_size: int

"""
    @validator('l2_id', 'keyword', pre=True)
    def check_at_least_one_filled_alternative(cls, v, values, **kwargs):
        if not (values.get('l2_id') or values.get('keyword')):
            raise ValueError("At least one of l2_id or keyword must be filled.")
 
    @validator('keyword')
    def validate_user_id(cls, v):
        if len(v) < 2:
            raise ValueError("keyword必须至少是2位字符串")
        return v
"""

class CompanyResponse(CompanyBase):
    createdAt: datetime
    updatedAt: datetime